<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="/script/jquery-1.8.0.min.js"></script>
</head>
<body>
<input type="text" id="message">
<button onclick="reply()">确定</button>
<input type="hidden" id="buyUserId" th:value="${buyUserId}">
<input type="hidden" id="pid" th:value="${pid}" >
</body>
<script>
    function reply() {
        var message = {
            "message": $("#message").val(),
            "buyUserId": $("#buyUserId").val(),
            "pid" : $("#pid").val()
        }
        var m1 = JSON.stringify(message);
        console.log(message);
        console.log(m1);
        $.ajax({
            url: "/leaveMessage",
            type: "post",
            dataType: "json",
            contentType: "application/json",
            data: m1,
            success: function (result) {
                console.log(result);
                if (result.code == 200){
                    alert("回复成功");
                    parent.location.reload();
                }
            },
            error: function (e) {
                console.log(e);
            }
        })
    }
</script>
</html>